/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package gmovil_jpa.entidades;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author castlerock
 */
@Entity
@Table(name = "valor_atributo_articulo")
@NamedQueries({
    @NamedQuery(name = "ValorAtributoArticulo.findAll", query = "SELECT v FROM ValorAtributoArticulo v"),
    @NamedQuery(name = "ValorAtributoArticulo.findByIdValorAtributoArticulo", query = "SELECT v FROM ValorAtributoArticulo v WHERE v.idValorAtributoArticulo = :idValorAtributoArticulo"),
    @NamedQuery(name = "ValorAtributoArticulo.findByValor", query = "SELECT v FROM ValorAtributoArticulo v WHERE v.valor = :valor")})
public class ValorAtributoArticulo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_valor_atributo_articulo")
    private Integer idValorAtributoArticulo;
    @Basic(optional = false)
    @Column(name = "valor")
    private String valor;
    @JoinColumn(name = "fid_articulo", referencedColumnName = "id_articulo")
    @ManyToOne(optional = false)
    private Articulo articulo;
    @JoinColumn(name = "fid_atributo", referencedColumnName = "id_atributo")
    @ManyToOne(optional = false)
    private Atributo atributo;

    public ValorAtributoArticulo() {
    }

    public ValorAtributoArticulo(Integer idValorAtributoArticulo) {
        this.idValorAtributoArticulo = idValorAtributoArticulo;
    }

    public ValorAtributoArticulo(Integer idValorAtributoArticulo, String valor) {
        this.idValorAtributoArticulo = idValorAtributoArticulo;
        this.valor = valor;
    }

    public Integer getIdValorAtributoArticulo() {
        return idValorAtributoArticulo;
    }

    public void setIdValorAtributoArticulo(Integer idValorAtributoArticulo) {
        this.idValorAtributoArticulo = idValorAtributoArticulo;
    }

    public String getValor() {
        return valor;
    }

    public void setValor(String valor) {
        this.valor = valor;
    }

    public Articulo getArticulo() {
        return articulo;
    }

    public void setArticulo(Articulo articulo) {
        this.articulo = articulo;
    }

    public Atributo getAtributo() {
        return atributo;
    }

    public void setAtributo(Atributo atributo) {
        this.atributo = atributo;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idValorAtributoArticulo != null ? idValorAtributoArticulo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ValorAtributoArticulo)) {
            return false;
        }
        ValorAtributoArticulo other = (ValorAtributoArticulo) object;
        if ((this.idValorAtributoArticulo == null && other.idValorAtributoArticulo != null) || (this.idValorAtributoArticulo != null && !this.idValorAtributoArticulo.equals(other.idValorAtributoArticulo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "gmovil_jpa.entidades.ValorAtributoArticulo[idValorAtributoArticulo=" + idValorAtributoArticulo + "]";
    }

}
